#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
int n;
int pwrvalue[100100];
bool isAttacked[100100];
int deadMonsters=0;
queue<int> bianjie;
int bbbbb;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&bbbbb);
        pwrvalue[i]=bbbbb;
    }
    pwrvalue[n]=-1;
    sort(pwrvalue,pwrvalue+n+1);
    bianjie.push(-1);
    for(int i=1;i<=n;i++)
    {
        if(pwrvalue[i]>pwrvalue[i-1])
        {
            bianjie.push(i-1);
        }
    }
    int chabianjie=-1;
    for(int i=0;i<=n;i++)
    {
        if((i^0) && (pwrvalue[i]>pwrvalue[i-1]))
        {
            bianjie.pop();
        }
        chabianjie=bianjie.front();
        for(int j=chabianjie;j>=0;j--)
        {
            if(!isAttacked[j])
            {
                isAttacked[j]=true;
                deadMonsters++;
                break;
            }
        }
    }
    deadMonsters--;
    printf("%d",n-deadMonsters);
    return 0;
}
